<?php
/* @var $this UserAdminController */
/* @var $model User */
/* @var $form CActiveForm */
?>

<div class="row-fluid sortable">
	<div class="box span12">
		<div class="box-header well" data-original-title>
			<h2>
				<i class="icon-edit">
				</i>
				<?php FormHelper::getFormBoxHeader('user') ?>
			</h2>
			<div class="box-icon">
				<?php FormHelper::getBoxIcon(); ?>
			</div>
		</div>
		<div class="box-content">
			<?php 
            $form=$this->beginWidget('CActiveForm', array(
            	'id'=>'user-form',
            	// Please note: When you enable ajax validation, make sure the corresponding
            	// controller action is handling ajax validation correctly.
            	// There is a call to performAjaxValidation() commented in generated controller code.
            	// See class documentation of CActiveForm for details on this.
            	'enableAjaxValidation'=>false,
                'htmlOptions'=>array(
                    'class'=>'form-horizontal',
                ),
            )); 
            ?>
				<fieldset>
					<div class="control-group">
						<?php echo $form->labelEx($model,'email',FormHelper::setClass('labelEx')); ?>
                		<div class="controls">
				        <?php 
                        if($this->action->getId()=='update'){
                            echo $form->textField($model,'email',FormHelper::setClass('textFieldDisable')); 
                        }else{
                            echo $form->textField($model,'email',FormHelper::setClass('textField'));
                        }
                        ?>
                		<?php echo $form->error($model,'email'); ?>
                      	</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'password',FormHelper::setClass('labelEx')); ?>
                		<div class="controls">
				        <?php
                            if($this->action->getId()=='update'){	
                                echo $form->textField($model,'password',FormHelper::setClass('textFieldDisable')); 
                        	}else{
                                echo $form->textField($model,'password',FormHelper::setClass('textField'));
                            }
                        ?>
                		<?php echo $form->error($model,'password'); ?>
                      	</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'firstname',FormHelper::setClass('labelEx')); ?>
                		<div class="controls">
				        <?php echo $form->textField($model,'firstname',FormHelper::setClass('textField')); ?>
                		<?php echo $form->error($model,'firstname'); ?>
                      	</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'lastname',FormHelper::setClass('labelEx')); ?>
                		<div class="controls">
				        <?php echo $form->textField($model,'lastname',FormHelper::setClass('textField')); ?>
                		<?php echo $form->error($model,'lastname'); ?>
                      	</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'gender',FormHelper::setClass('labelEx')); ?>
						<div class="controls">
							<label class="radio">
								<?php echo $form->radioButton($model,'gender'); ?>
                                <?php echo $form->error($model,'gender'); ?>
								Nữ
							</label>
							<div style="clear:both">
							</div>
                            <label class="radio">
								<?php echo $form->radioButton($model,'gender'); ?>
                                <?php echo $form->error($model,'gender'); ?>
								Nam
							</label>
						</div>
					</div>
					<div class="control-group">
                        <?php
                        	$model->birthday=date('d/m/Y',$model->birthday);
                        ?>
						<?php echo $form->labelEx($model,'birthday',FormHelper::setClass('labelEx')); ?>
						<div class="controls">
							<?php echo $form->textField($model,'birthday',FormHelper::setClass('textFieldDate')); ?>
                            <?php echo $form->error($model,'birthday'); ?>
						</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'passport',FormHelper::setClass('labelEx')); ?>
                		<div class="controls">
				        <?php echo $form->textField($model,'passport',FormHelper::setClass('textField')); ?>
                		<?php echo $form->error($model,'passport'); ?>
                      	</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'address',FormHelper::setClass('labelEx')); ?>
                		<div class="controls">
				        <?php echo $form->textField($model,'address',FormHelper::setClass('textField')); ?>
                		<?php echo $form->error($model,'address'); ?>
                      	</div>
					</div>
                    <div class="control-group">
                        <?php echo $form->labelEx($model,'city',FormHelper::setClass('labelEx')); ?>
                		<div class="controls">
				        <?php echo $form->dropDownList($model,'city',CHtml::listData(City::model()->findAll(),'city_id','city_name'),array('empty'=>'-- Chọn tỉnh thành --',));?>
                		<?php echo $form->error($model,'city'); ?>
                      	</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'mobile',FormHelper::setClass('labelEx')); ?>
                		<div class="controls">
				        <?php echo $form->textField($model,'mobile',FormHelper::setClass('textField')); ?>
                		<?php echo $form->error($model,'mobile'); ?>
                      	</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'status',FormHelper::setClass('labelEx')); ?>
                		<div class="controls">
                        <?php echo $form->checkBox($model,'status',array('class'=>'iphone-toggle','data-no-uniform'=>'true')); ?>
                		<?php echo $form->error($model,'status'); ?>
                      	</div>
					</div>
                    <div class="control-group">
                        <?php
                        	$model->permission=explode(';',$model->permission);
                        ?>
						<?php echo $form->labelEx($model,'permission',array('class'=>'control-label')); ?>
						<div class="controls">
                            <?php echo $form->checkBoxList($model,'permission',CHtml::listData(Permission::model()->findAll(),'permission_id','permission_name'),array('labelOptions'=>array('style'=>'display:inline;width:150px;'))); ?>
                            <?php echo $form->error($model,'permission'); ?>
						</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'signup',array('class'=>'control-label')); ?>
                		<div class="controls">
				        <?php echo $form->textField($model,'signup',FormHelper::setClass('textFieldDisable')); ?>
                		<?php echo $form->error($model,'signup'); ?>
                      	</div>
					</div>
                    <div class="control-group">
						<?php echo $form->labelEx($model,'lastlogin',array('class'=>'control-label')); ?>
                		<div class="controls">
				        <?php echo $form->textField($model,'lastlogin',FormHelper::setClass('textFieldDisable')); ?>
                		<?php echo $form->error($model,'lastlogin'); ?>
                      	</div>
					</div>
                    <div class="form-actions">
						<?php echo CHtml::submitButton($model->isNewRecord ? 'Thêm mới' : 'Lưu thay đổi',FormHelper::setClass('submitButton')); ?>
					</div>
				</fieldset>
			<?php $this->endWidget(); ?>
		</div>
	</div>
	<!--/span-->
</div>